/*
 * The RavenX Library
 * Copyright (c) 2008 by Solidus
 * 
 * Permission to use, copy, modify, distribute and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.It is provided "as is" without express 
 * or implied warranty.
 *
 */


#ifndef RX_HASH_TABLE_H
#define RX_HASH_TABLE_H

#include "rx_typedef.h"



typedef struct __rx_hash_node_tag rx_hash_node_t;
typedef struct __rx_hashtable_tag rx_hashtable_t;

RavenAPI rx_hash_node_t* rx_hashtable_node_first(const rx_hashtable_t *self);
RavenAPI rx_hash_node_t* rx_hashtable_node_next(const rx_hashtable_t *self, rx_hash_node_t *node);
RavenAPI void*			rx_hashtable_node_data(rx_hash_node_t *node);


RavenAPI rx_hashtable_t* rx_hashtable_create(const rx_info_t *info, const rx_alloc_t *palloc);
RavenAPI void			 rx_hashtable_destroy(rx_hashtable_t *self);
RavenAPI size_t			 rx_hashtable_size(const rx_hashtable_t *self);
RavenAPI rx_hashtable_t* rx_hashtable_copy(const rx_hashtable_t *self);
RavenAPI void			 rx_hashtable_clear(rx_hashtable_t *self);

RavenAPI void			 rx_hashtable_swap(rx_hashtable_t *left, rx_hashtable_t *right);

RavenAPI rx_hash_node_t* rx_hashtable_insert_unique(rx_hashtable_t *self, const void *data);
RavenAPI rx_hash_node_t* rx_hashtable_insert_equal(rx_hashtable_t *self, const void *data);


RavenAPI rx_hash_node_t* rx_hashtable_find(const rx_hashtable_t *self, const void *key);
RavenAPI size_t			 rx_hashtable_node_count(const rx_hashtable_t *self, const void *key);

RavenAPI rx_hash_node_t* rx_hashtable_erase_node(rx_hashtable_t *self, rx_hash_node_t *node);
RavenAPI rx_hash_node_t* rx_hashtable_erase_range(rx_hashtable_t *self, rx_hash_node_t *first, rx_hash_node_t *last);
RavenAPI size_t	rx_hashtable_erase_key(rx_hashtable_t *self, const void *key);


RavenAPI size_t rx_hashtable_bucket_size(const rx_hashtable_t *self);
RavenAPI size_t rx_hashtable_bucket_node_size(const rx_hashtable_t *self, size_t i);







#endif


